import { _decorator, Button, Vec3, UITransform } from 'cc';
import { NewClass, setClassName } from '../Base/Global';
import { AssetInfo } from '../Manager/ResourceLoad/base/AssetInfo';
import { UIWindow } from '../Manager/UI/UIWindow';
const { ccclass } = _decorator;


@ccclass('TestPanel')
export class TestPanel extends UIWindow 
{
    private static mainAssetInfo : AssetInfo = null;
    private button : Button = null;
    public GetAssetInfo(): AssetInfo 
    {
        if(TestPanel.mainAssetInfo == null)
        {
            var assetInfo = NewClass(AssetInfo)
            assetInfo.assetBundleName = AssetInfo.resourceBundle
            assetInfo.assetName = "prefabs/testPanel";
            TestPanel.mainAssetInfo = assetInfo;
        }
        
        return TestPanel.mainAssetInfo;
    }
    public OnLoadUIMap() {
        this.button = this.uiNode.getChildByName("Button").getComponent(Button);
        this.button.node.on("click", ()=>{console.log("button click")});
    }
    public OnLoad() {
       console.log("___TestPanel__OnLoad___");
       this.uiNode.active = true;
       this.uiNode.setPosition(Vec3.ZERO);
       console.log(this.uiNode);
    }
    public OnDestroy() {
    }
}

setClassName(TestPanel, "TestPanel");